home *** CD-ROM | disk | FTP | other *** search
- unit Closemsg;
- {
- PC Plus sample Delphi program.
- Description: A 'faked modal' dialog box which is displayed on screen
- for a defined period. Similar dialogs could be used as
- 'splash screens' to be displayed while your program is loading.
- The present dialog is used by the International Clock
- application, intclock.dpr. It demonstrates the use of a Timer
- object to implement a delay. It has no real function
- apart from that.
- Author: Huw Collingbourne
- }
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, ExtCtrls, StdCtrls;
-
- type
- TCloseMsgForm = class(TForm)
- Label1: TLabel;
- Timer1: TTimer;
- procedure Timer1Timer(Sender: TObject);
- procedure FormShow(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- CloseMsgForm: TCloseMsgForm;
- ATick : integer;
-
- implementation
-
- {$R *.DFM}
-
- { This implements a modal form which lacks the usual OK, Cancel buttons.
- Therefore the form must be closed by the code rather than the user
- by returning ModalResult := mrOK }
-
- procedure TCloseMsgForm.Timer1Timer(Sender: TObject);
- { Display form for a number of 'ticks' - i.e. timer events }
- const
- TickCount = 20;
- begin
- Label1.Caption := Label1.Caption + '.';
- Inc(ATick);
- if ATick = TickCount then ModalResult := mrOK;
- end;
-
- procedure TCloseMsgForm.FormShow(Sender: TObject);
- { Init the timer and the ATick variable when this form is shown }
- begin
- Timer1.Enabled := True;
- Timer1.Interval := 100;
- ATick := 0;
- end;
-
- end.
-